//
//  EPMDestinationTableViewCell.m
//  myXianfeng
//
//  Created by 马继鵬 on 17/5/4.
//  Copyright © 2017年 EPM. All rights reserved.
//

#import "EPMDestinationTableViewCell.h"
#import "EPMAddressViewController.h"

@interface EPMDestinationTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *labName;
@property (weak, nonatomic) IBOutlet UILabel *labGender;
@property (weak, nonatomic) IBOutlet UILabel *labNumber;
@property (weak, nonatomic) IBOutlet UILabel *labAddress;


@end

@implementation EPMDestinationTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self setupUI];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
}

#pragma mark - 设置UI -
-(void)setupUI{
    UIControl* control = [[UIControl alloc]init];
    [self.contentView addSubview:control];
    
    [control mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(self.contentView).offset(-8);
        make.centerY.equalTo(self.contentView);
        make.width.mas_equalTo(30);
        make.height.mas_equalTo(20);
    }];
    UIImageView* imgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_go"]];
    [control addSubview:imgView];
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(control);
        make.trailing.equalTo(control).offset(0);
        make.width.mas_equalTo(5);
        make.height.mas_equalTo(10);
    }];
    
    UILabel* label = [[UILabel alloc]init];
    label.text = @"修改";
    label.textColor = [UIColor blueColor];
    label.textAlignment = NSTextAlignmentRight;
    [control addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(imgView.mas_leading).offset(-7);
        make.centerY.equalTo(imgView);
    }];
    
    [control addTarget:self action:@selector(actionControlClicked:) forControlEvents:UIControlEventTouchUpInside];
}

#pragma mark - 点击事件 -

- (void)actionControlClicked:(UIButton*)sender{
    if(self.addressAlterBlock){
        self.addressAlterBlock();
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
